//
//  HRTabBarButton.m
//  心理FM
//
//  Created by rui on 7/9/15.
//  Copyright (c) 2015 loverforevercyr. All rights reserved.
//

#import "HRTabBarButton.h"

@implementation HRTabBarButton

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

/*
 *  通过代码创建对象时要执行的方法，设置_imageView的模式和_titleLabel
 */
- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        self.imageView.contentMode = UIViewContentModeScaleAspectFit;
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
        self.titleLabel.font = [UIFont systemFontOfSize:12];
    }
    
    return self;
}

- (void)setHighlighted:(BOOL)highlighted {
    
}

- (CGRect)imageRectForContentRect:(CGRect)contentRect {
    return CGRectMake(0, 0, contentRect.size.width, contentRect.size.height * 0.7);
}

- (CGRect)titleRectForContentRect:(CGRect)contentRect {
    return CGRectMake(0, 0.6 * contentRect.size.height, 1 * contentRect.size.width, 0.4 * contentRect.size.height);
}

@end
